<?php


namespace app\model;


use app\utils\DateTime;

class UsingroomTime extends BaseModel
{
    protected $updateTime = '';
    protected $createTime = '';

    public function setDateTime(){
        return new DateTime();
    }

    public function setStartTimeAttr($value){
        return $this->setDateTime()->setTime($value);
    }

    public function setEndTimeAttr($value){
        return $this->setDateTime()->setTime($value);
    }

    public function getStartTimeAttr($value){
        return $this->setDateTime()->getTime($value);
    }

    public function getEndTimeAttr($value){
        return $this->setDateTime()->getTime($value);
    }

    public function setDayAttr($value , $data){
        return $this->setDateTime()->getDay($data['start_time'] , $data['end_time']);
    }

    public function Room(){
        return $this->belongsTo(Room::class , 'room_id' , 'id');
    }
}
